package FlowGraph.SSA;

import antlr.collections.*;

import FlowGraph.*;
import FlowGraph.StatementInfo.*;

//////////////////////////////////////////////////////////////////////////
//// VariableLocation
/**

@author Ivan Jeukens
@version v 0.1 03/02/2003
*/
public class VariableLocation {

    public VariableLocation(FlowGraphNode node, AST astNode,
            StatementInfo statinfo, boolean phinode) {
        _node = node;
        _astNode = astNode;
        _statinfo = statinfo;
        _phi = phinode;
    }

    ///////////////////////////////////////////////////////////////////
    ////                        public  methods                    ////

    public FlowGraphNode getFGNode() {
        return _node;
    }

    public StatementInfo getStatementInfo() {
        return _statinfo;
    }

    public AST getASTNode() {
        return _astNode;
    }

    public boolean isPhiNode() {
        return _phi;
    }

    public String toString() {
        if(_phi) {
            return new String("Phi node " + _astNode.toStringTree() + 
               " Location " + _node.toString());
        }
        if(_astNode == null) {
            return new String("Location of entry def : " + _node.toString());
        }
        return new String("Location : " + _node.toString() +
            " ast : " + _astNode.toStringTree());
    }

    ///////////////////////////////////////////////////////////////////
    ////                        private methods                    ////

    ///////////////////////////////////////////////////////////////////
    ////                      private variables                    ////

    private FlowGraphNode _node;
    private AST _astNode;
    private StatementInfo _statinfo;
    private boolean _phi;
}
